EPT (Edit and Presentation Templates) is a technique to manage information separated from the presentation. EPT can be used to define any kind of data set, from the most basic drop-down menus to complex database solutions. The same set of data can be presented in many different ways depending on the context. All EPT documents can be created and edited directly in Content Studio with drag-and-drop techniques.

The presentation formatting, layout and design is specified with Presentation Templates. The same set of information can be presented in different ways by applying different Presentation Templates.

Edit templates (ET)

The information structured and defined with Edit Template forms, where all data elements are specified. The Edit Template form contains the classic FORM objects such as input boxes, list boxes, radio buttons etc. They may also contain AS components, synchronous Java scripts and other components. The values of the form objects can be automatically validated to ensure that they have reasonable values.

The forms will automatically create XDR schemes to describe the data structure. The data is stored as XML and can easily be reused, exported, filtered and searched. The database storage is automatically managed, so there is no need to manually manage database tables when the data structure is altered.

Edit Template forms can be used with Content Studio, on the web site or on an intranet (using the DocumentWriter component). They can also be shared within a Multi Language Cluster (MLC). Both UTF-8 and right-adjusted editing forms are supported.

Form keywords and attributes

The data elements can be specified in detail either using the visual editor or by code. Each new element is given a default set of values to allow generic data input. The set of possible attributes depend on the type of object that is being used. The list below describes some of the generic attributes that can be used to describe the data object.

Attribute Description
required The object must have a value. It cannot be left blank or empty.
id The unique identifier of the object.
name The name of the object, which usually is the same as the identifier. The content of the field will be used as name for the document.
tabindex A numeric value to control the tab order of the form elements. If not used, the tab order is defined by the order of the objects.
cstitle The title of the document. The content of the field will be used as title for the document. If many object use this attribute, the document title will be the sum of all these values.
introduction The introduction of the document. The content of the field will be used as introduction for the document. If many object use this attribute, the document introduction will be the sum of all these values.
The content of the introduction field in the document are included in full text search.
cspublishdate The publish date of the document (when it first will be visible on the web site). The content of the field will be used as publishdate for the document.
csarchivedate The archive date of the document (when it no longer will be visible on the web site). The content of the field will be used as archivedate for the document.
minlength The least number of characters to be allowed.
email The value must be an e-mail address. The validation is purely syntactical and there is no confirmation that the supplied address actually exists.
personalid The value must be a valid social security number according to the Swedish standard (YYMMDD-XXXX)
integer The value must be an integer. When set it is also possible to define the attributes morethen, lessthen and not to control the values to allow.
elementimage The value is a reference to an image
elementurl The value is an URL
elementtarget The value indicates the target of an URL
keywords The keywords of the document. The content of the field will be copied into the keywords field of the document. As the keyword field of documents are used in full text search, the keywords can be used to add more match words.
Keywords are normally not visible on the web site, instead they are used when searching the web site.

The attributes are added automatically by Content Studio when generating the code. Here is an example of what the generated code can look like:

Html
 <input id="text1" tabindex="0" name="text1" minlength="6" cstitle="1" required="1" />

Javascript events

Content Studio supports synchronous Javascript events. They make it possible to for example perform advanced input validation, user notification and other actions connected to certain document operations. Since the Javascript events are synchronous, they can be used to interrupt or prevent other events from taking place.

Events are configured by assigning special variables the value of Javascript function names. The variable names describe the event to which they are connected. The following special variable names are available:

  • OnPageLoad
  • OnBeforePageLoad
  • OnBeforeDocumentSave
  • OnBeforeDocumentCreate
  • OnBeforeDocumentPreview
  • OnBeforeDocumentCheckIn
  • OnBeforeDocumentCheckOut
  • OnBeforeDocumentApprove
  • OnBeforeDocumentReject
  • OnBeforeDocumentDelete
  • OnDocumentSave
  • OnDocumentCreate
  • OnDocumentCheckIn
  • OnDocumentCheckOut
  • OnDocumentApprove
  • OnDocumentReject
  • OnDocumentDelete
  • OnBeforePerformUserAction (NOT IMPLEMENTED YET)
  • OnPerformUserAction (NOT IMPLEMENTED YET)
  • OnBeforeSendForRevision
  • OnSendForRevision

All events can be prevented from being executed by letting the function that is executed before the event (named OnBefore...) return a false value. Then, the following event is ignored. This is typically used then validating field values.

Here is an example where the fields of an ET form are combined before the page is saved or previewed.

Javascript
< script language="jscript" >
   function combineFields()
   {
     var sPre = (male.checked) ? "Mr. " : "Ms. ";
     full_name.value = sPre + surname.value + " " + last_name.value;
     return true;
   }
   OnBeforeDocumentSave = "combineFields();";
   OnBeforeDocumentPreview = OnBeforeDocumentSave;
</script>

Presentation templates (PT)

Presentation templates are used to present XML data sources, typically ET forms. The Presentation template controls which fields to display and how they are displayed. It can of course also contain static text, dynamic components and all other things that can be included in a displayed document.

The Presentation template is always used dynamically and by reference. This means that changes in the presentation template will have effect on all places where it is used without any additional effort.

Documents within a category can be assigned a default Presentation template that is used unless otherwise specified. The default value can be overridden by explicitly use a particular PT identifier (PTID) when referring to a document. The PT is identified by the document in which it is defined.

Example when referring to a document (id=2000) using its default PT:

http://www.mysite.com/default.aspx?id=2000

Example when using the PT defined in document 3000:

http://www.mysite.com/default.aspx?id=2000&PTID=3000

EPT-related properties and methods

There are a large number of properties to work with when creating EPT documents. Most of the functionality in regular documents is also available in EPT documents. The complete set of available methods and variables are described in the API documentation.

Some EPT-related members
Name Description
CS_DataFields

This property, meaningful in EPT presentation templates only, gets an EPTXmlParser object that has a collection of EPT field names and their values.  For other types of documents this property always null (Nothing in Visual Basic)

The following code snippet shows how to get the value of an EPT field named Header

Response.Write(CS_DataFields["Header"]);
Response.Write(CS_DataFields("Header"))
The approved content is available and BROWSE permission is required. If the field name does not exist, null (Nothing in Visual Basic) is returned.
CS_EditDataFields

Gets an EPTXmlParser object that has a collection of EPT field definitions for an edit template or any document that edits an EPT document. For other types of documents this property always null (Nothing in Visual Basic)
The most recently saved values are available but read permissions are required to get any values. If the field name does not exist, null (Nothing in Visual Basic) is returned.

CS_InsertedDocumentId Gets the identifier of the document where it is used. If it is used within an included document it will use the identity of the included document, not the identity of the including document. In a presentation template, this is the presented document rather than the presentation template itself.
CS_InsertedPresentationTemplateId Gets the identity of the Presentation template that is being used.
CS_InsertedCategoryId Gets the identifier of the category of the document.
CS_GetAnyEPTDocument() This method returns an EPTXmlParser object for any EPT document where the caller has permission.

Data categories

The general definition of a document is something that store data according to a specified ET. It does not have to be a HTML page. Document categories that mainly are intended to keep simple data are sometimes referred to as data categories. But any category with documents that are based on an ET can be considered a data category.

A very common situation when developing a website is to manage a small set of more or less dynamic data, i.e. to fill a dropdown box that is used within a form. This can often easily be solved by using documents in a specific category. To enable the EPT fields to be used as data fields, they must be indexed.

Here follows a simple example of using EPT data categories to fill a dropdown box using the AS component "List filtered documents in dropdown advanced 2.0". To fill the dropdown box, simply do the following under component properties:

The component has many settings, but here we focus only on the data that is picked from the data categories. The layout definitions, cache settings and similar are described elsewhere for each component.